package com.example.property.service.impl;

import com.example.property.mapper.RoomMapper;
import com.example.property.pojo.PageResult;
import com.example.property.pojo.Room;
import com.example.property.service.RoomService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
@Service
public class RoomServiceImpl implements RoomService {
    @Autowired
    RoomMapper roomMapper;
    @Override
    public PageResult<Room> pageOfRoom(Map<String, String> map) {
        PageHelper.startPage(Integer.parseInt(map.get("current"))
                ,Integer.valueOf(map.get("size")));
        Page<Room> rooms = roomMapper.pageOfRooms(map);
        return PageResult.restPage(rooms);

    }

    @Override
    public int changeRoomStatus(List<Integer> idList, int status)
    {
        return roomMapper.changeRoomStatus(idList,status);
    }
}
